package com.bao.work.video;

import com.bao.work.video.entity.Video;
import com.bao.work.video.service.UserService;
import com.bao.work.video.service.VideoService;
import com.bao.work.video.service.impl.UserServiceImpl;
import com.bao.work.video.service.impl.VideoServiceImpl;

/**
 * @author baoye
 * @date 2024-08-01/17:20
 */
public class SystemMessage {
    public static final UserService USER_SERVICE=new UserServiceImpl();
    public static final VideoService VIDEO_SERVICE=new VideoServiceImpl();
    public static void main(String[] args) {
        int count=0;
        while(true){
            if(USER_SERVICE.login()){
                System.out.println("登录成功");
                break;
            }else {
                System.out.println("登录失败");
            }
            if(count==2){
                System.out.println("登录失败次数超过三次,滚");
                System.exit(0);
            }
            count++;
        }
        //登录成功,进入菜单页
        while(true){
            System.out.println("欢迎使用观影指南管理器");
            System.out.println("1.添加电影");
            System.out.println("2.查看电影");
            System.out.println("3.显示人气最高电影");
            System.out.print("请选择:");
            int order=VIDEO_SERVICE.INPUT.nextInt();
            switch (order){
                case 1:
                    VIDEO_SERVICE.insertVideo();
                    break;
                case 2:
                    VIDEO_SERVICE.printVideo();
                    break;
                case 3:
                    VIDEO_SERVICE.maxHot();
                    break;
                default:
                    System.err.println("退出系统");
                    System.exit(0);
            }
        }
    }
}
